<template>
	<view class="savepadding p-content">

		<view class="item" style="padding: 20rpx 30rpx 0;margin-top: 20rpx;" id="baseInfo" v-if="showBaseInfo">

			<u-form :model="addbean" ref="uform" label-width="auto">

				<view style="height: 50rpx;display: flex;align-items: center;">
					<u-icon name="order" color="#1573FF" label="基本信息" label-color="#333333"></u-icon>
				</view>

				<u-form-item label="选择出租方" v-if="viewStateBean.lessorId[0]" :required="viewStateBean.lessorId[2]"
					borderBottom @click="viewStateBean.lessorId[1] && selLessor()">
					<u-input v-model="addbean.lessorName" inputAlign="right" placeholder="选择出租方" disabled
						disabledColor="#ffffff" border="none"></u-input>

					<view slot="right">
						<u-icon v-if="viewStateBean.lessorId[1]" name="arrow-right"></u-icon>
					</view>
				</u-form-item>

				<u-form-item label="选择客户" v-if="viewStateBean.customerId[0]" :required="viewStateBean.customerId[2]"
					borderBottom @click="viewStateBean.customerId[1] && selCustomer()">
					<u-input v-model="addbean.customerName" inputAlign="right" placeholder="选择客户" disabled
						disabledColor="#ffffff" border="none"></u-input>

					<view slot="right">
						<u-icon v-if="viewStateBean.customerId[1]" name="arrow-right"></u-icon>
					</view>
				</u-form-item>

				<u-form-item label="客户名称" v-if="viewStateBean.customerName[0]" :required="viewStateBean.customerName[2]"
					borderBottom>
					<u-input v-model="addbean.customerName" inputAlign="right"
						:disabled="!viewStateBean.customerName[1]" disabledColor="#ffffff" border="none"
						placeholder="选择客户自动获取"></u-input>
				</u-form-item>

				<u-form-item label="联系地址" v-if="viewStateBean.customerAddr[0]" :required="viewStateBean.customerAddr[2]"
					borderBottom>
					<u-input v-model="addbean.customerAddr" inputAlign="right"
						:disabled="!viewStateBean.customerAddr[1]" disabledColor="#ffffff" border="none"
						placeholder="选择客户自动获取">
					</u-input>
				</u-form-item>

				<u-form-item label="联系电话" v-if="viewStateBean.customerTel[0]" :required="viewStateBean.customerTel[2]">
					<u-input v-model="addbean.customerTel" inputAlign="right" :disabled="!viewStateBean.customerTel[1]"
						disabledColor="#ffffff" border="none" placeholder="选择客户自动获取">
					</u-input>
				</u-form-item>

			</u-form>

		</view>

		<view class="item" style="padding: 20rpx 30rpx 0;" id="carOrderInfo" v-if="showCarOrderInfo">

			<u-form :model="addbean" ref="uform" label-width="auto">

				<view style="height: 50rpx;display: flex;align-items: center;">
					<u-icon name="order" color="#1573FF" label="车辆订单信息" label-color="#333333"></u-icon>
				</view>

				<u-form-item label="租赁类型" v-if="viewStateBean.rentType[0]" :required="viewStateBean.rentType[2]"
					borderBottom>
					<u-input v-model="addbean.plan.rentTypeName" inputAlign="right" border="none"
						:disabled="!viewStateBean.rentType[1]" disabledColor="#ffffff" placeholder=""></u-input>
				</u-form-item>

				<u-form-item label="品牌/车系/车型" v-if="viewStateBean.selectCarModel[0]"
					:required="viewStateBean.selectCarModel[2]" borderBottom
					@click="viewStateBean.selectCarModel[1] && pickerShow(2)">
					<u-input v-model="addbean.plan.brandSeriesModel" inputAlign="right" placeholder="请选择品牌/车系/车型"
						disabled disabledColor="#ffffff" border="none"></u-input>
					<view slot="right">
						<u-icon v-if="viewStateBean.selectCarModel[1]" name="arrow-right"></u-icon>
					</view>
				</u-form-item>

				<u-form-item v-if="viewStateBean.cashDeposit[0]" :required="viewStateBean.cashDeposit[2]"
					label="保证金/元/台" borderBottom>
					<u-input v-model="addbean.plan.cashDeposit" type="digit" inputAlign="right"
						:disabled="!viewStateBean.cashDeposit[1]" disabledColor="#ffffff" placeholder="请输入"
						border="none"></u-input>
				</u-form-item>

				<u-form-item v-if="viewStateBean.downPayment[0]" :required="viewStateBean.downPayment[2]"
					label="首付款/元/台" borderBottom>
					<u-input v-model="addbean.plan.downPayment" type="digit" inputAlign="right"
						:disabled="!viewStateBean.downPayment[1]" disabledColor="#ffffff" placeholder="请输入"
						border="none"></u-input>
				</u-form-item>

				<u-form-item v-if="viewStateBean.servicingFee[0]" :required="viewStateBean.servicingFee[2]"
					label="整备费/元/台" borderBottom>
					<u-input v-model="addbean.plan.servicingFee" type="digit" inputAlign="right"
						:disabled="!viewStateBean.servicingFee[1]" disabledColor="#ffffff" placeholder="请输入"
						border="none"></u-input>
				</u-form-item>

				<u-form-item v-if="viewStateBean.totalPrice[0]" :required="viewStateBean.totalPrice[2]"
					label="车辆总单价/元/台" borderBottom>
					<u-input v-model="addbean.plan.totalPrice" type="digit" inputAlign="right"
						:disabled="!viewStateBean.totalPrice[1]" disabledColor="#ffffff" placeholder="请输入"
						border="none"></u-input>
				</u-form-item>

				<u-form-item v-if="viewStateBean.monthlyRent[0]" :required="viewStateBean.monthlyRent[2]"
					label="月租金/元/台" borderBottom>
					<u-input v-model="addbean.plan.monthlyRent" type="digit" inputAlign="right"
						:disabled="!viewStateBean.monthlyRent[1]" disabledColor="#ffffff" placeholder="请输入"
						border="none"></u-input>
				</u-form-item>

				<u-form-item v-if="viewStateBean.hasBalancePayment[0]" :required="viewStateBean.hasBalancePayment[2]"
					label="尾款/元/台" borderBottom @click="viewStateBean.hasBalancePayment[1] && addFinalFee()">
					<u-input v-model="balancestr" inputAlign="right" placeholder="添加尾款" disabled
						disabledColor="#ffffff" border="none"></u-input>
					<view slot="right">
						<u-icon v-if="viewStateBean.hasBalancePayment[1]" name="arrow-right"></u-icon>
					</view>
				</u-form-item>

				<u-form-item v-if="viewStateBean.financeCompanyName[0]" :required="viewStateBean.financeCompanyName[2]"
					label="金融公司名称" borderBottom>
					<u-input v-model="addbean.plan.financeCompanyName" inputAlign="right"
						:disabled="!viewStateBean.financeCompanyName[1]" disabledColor="#ffffff" border="none"
						placeholder="请输入"></u-input>
				</u-form-item>

				<u-form-item v-if="viewStateBean.freeDays[0]" :required="viewStateBean.freeDays[2]" label="免费用车天数"
					borderBottom>
					<u-input v-model="addbean.plan.freeDays" type="number" inputAlign="right"
						:disabled="!viewStateBean.freeDays[1]" disabledColor="#ffffff" border="none" placeholder="请输入">
					</u-input>
				</u-form-item>

				<u-form-item v-if="viewStateBean.coverCharge[0]" :required="viewStateBean.coverCharge[2]" label="服务费"
					borderBottom>
					<u-input :disabled="!viewStateBean.coverCharge[1]" disabledColor="#ffffff"
						v-model="addbean.plan.coverCharge" type="digit" inputAlign="right" border="none"
						placeholder="请输入">
					</u-input>
				</u-form-item>

				<u-form-item v-if="viewStateBean.repaymentMethods[0]" :required="viewStateBean.repaymentMethods[2]"
					label="还款方式" borderBottom @click="viewStateBean.repaymentMethods[1] && pickerShow(1)">
					<u-input v-model="addbean.plan.paymentMethodName" inputAlign="right" placeholder="请选择还款方式" disabled
						disabledColor="#ffffff" border="none"></u-input>
					<view slot="right">
						<u-icon v-if="viewStateBean.repaymentMethods[1]" name="arrow-right"></u-icon>
					</view>
				</u-form-item>

				<view v-if="viewStateBean.paymentDay[0]" style="display: flex;flex-direction: column;">

					<u-form-item label="还款日" :required="viewStateBean.paymentDay[2]">
					</u-form-item>

					<view class="mradio" @click="addbean.orderCar.paymentDayType=1">
						<u-icon :color="1==addbean.orderCar.paymentDayType?'#1573FF':'#333'"
							:name="1==addbean.orderCar.paymentDayType?'checkmark-circle-fill':'checkmark-circle'"
							size="18"></u-icon>
						<text>还款日与交车日一致</text>
					</view>

					<view class="mradio" style="margin-top: 10rpx;" @click="addbean.orderCar.paymentDayType=2">
						<u-icon :color="2==addbean.orderCar.paymentDayType?'#1573FF':'#333'"
							:name="2==addbean.orderCar.paymentDayType?'checkmark-circle-fill':'checkmark-circle'"
							size="18"></u-icon>
						<text style="flex: 1;white-space: nowrap;">选择还款日</text>

						<view style="display: flex;align-items: center;"
							@click.stop="viewStateBean.paymentDay[1] && pickerShow(3)">
							<u-input v-model="payDayStr" inputAlign="right" placeholder="请选择还款日" disabled
								disabledColor="#ffffff" border="none"></u-input>
							<view slot="right">
								<u-icon v-if="viewStateBean.paymentDay[1]" name="arrow-right"></u-icon>
							</view>
						</view>

					</view>

					<view style="height: 1rpx;background-color: #ebebec;margin-top: 10rpx;">
					</view>

				</view>

				<u-form-item v-if="viewStateBean.timeRepayment[0]" :required="viewStateBean.timeRepayment[2]"
					label="还款时间" borderBottom @click="viewStateBean.timeRepayment[1] && pickerShow(7)">
					<u-input v-model="addbean.orderCar.timeRepayment" inputAlign="right" placeholder="请选择" disabled
						disabledColor="#ffffff" border="none"></u-input>
					<view slot="right">
						<u-icon v-if="viewStateBean.timeRepayment[1]" name="arrow-right"></u-icon>
					</view>
				</u-form-item>

				<!-- <u-form-item  label="车辆已购保险" borderBottom @click="goSelInsurance">
					<u-input v-model="addbean.licenseDate" inputAlign="right" placeholder="查看已购保险" disabled
						disabledColor="#ffffff" border="none"></u-input>
					<u-icon slot="right" name="arrow-right"></u-icon>
				</u-form-item> -->

				<view v-if="viewStateBean.insuranceItems[0]" style="display: flex;flex-direction: column;">

					<u-form-item :required="viewStateBean.insuranceItems[2]" label="车辆已购保险" prop="">
					</u-form-item>

					<uni-data-checkbox multiple v-model="insuranceValueList"
						:disabled="!viewStateBean.insuranceItems[1]" :localdata="insuranceList" :map="{
						'value':'value',
						'text':'value'
					}"></uni-data-checkbox>

					<view style="height: 1rpx;background-color: #ebebec;margin-top: 10rpx;">
					</view>
				</view>

				<view v-if="viewStateBean.tenancy[0]||viewStateBean.timeStartRent[0]"
					style="display: flex;flex-direction: column;">

					<u-form-item label="租期选择" :required="viewStateBean.tenancy[2]||viewStateBean.timeStartRent[2]">
					</u-form-item>

					<view class="mradio" v-if="viewStateBean.timeStartRent[0]" @click="addbean.plan.tenancyType=1">
						<u-icon :color="1==addbean.plan.tenancyType?'#1573FF':'#333'"
							:name="1==addbean.plan.tenancyType?'checkmark-circle-fill':'checkmark-circle'" size="18">
						</u-icon>
						<view style="display: flex;align-items: center;margin-left: 20rpx;">

							<text
								style="color: #a7a7a7;width: 200rpx;line-height: 40rpx;text-align: center;border: 1rpx solid #cecece;font-size: 26rpx;border-radius: 6rpx;"
								@click="viewStateBean.tenancy[1] && pickerShow(4)">{{addbean.plan.timeStartRent==null||addbean.plan.timeStartRent==''?'开始时间':addbean.plan.timeStartRent}}</text>
							<text style="margin: 0 15rpx;color: #a7a7a7;">—</text>
							<text
								style="color: #a7a7a7;width: 200rpx;line-height: 40rpx;text-align: center;border: 1rpx solid #cecece;font-size: 26rpx;border-radius: 6rpx;"
								@click="viewStateBean.tenancy[1] && pickerShow(5)">{{addbean.plan.timeFinishRent==null||addbean.plan.timeFinishRent==''?'结束时间':addbean.plan.timeFinishRent}}</text>

						</view>
					</view>

					<view class="mradio" v-if="viewStateBean.tenancy[0]" style="margin-top: 10rpx;"
						@click="addbean.plan.tenancyType=2">
						<u-icon :color="2==addbean.plan.tenancyType?'#1573FF':'#333'"
							:name="2==addbean.plan.tenancyType?'checkmark-circle-fill':'checkmark-circle'" size="18">
						</u-icon>
						<text style="flex: 1;white-space: nowrap;">租期选择(月)</text>

						<view style="display: flex;align-items: center;">
							<u-input v-model="addbean.plan.tenancy" :disabled="!viewStateBean.tenancy[1]"
								disabledColor="#ffffff" inputAlign="right" placeholder="请输入租赁期限" type="number"
								border="none"></u-input>
						</view>

					</view>

					<view style="height: 1rpx;background-color: #ebebec;margin-top: 10rpx;">
					</view>

				</view>

				<u-form-item v-if="viewStateBean.channel[0]" :required="viewStateBean.channel[2]" label="所属渠道商"
					borderBottom @click="viewStateBean.channel[1] && goSelChannel()">
					<u-input v-model="addbean.plan.channelName" inputAlign="right" placeholder="请选择渠道商" disabled
						disabledColor="#ffffff" border="none"></u-input>
					<view slot="right">
						<u-icon v-if="viewStateBean.channel[1]" name="arrow-right"></u-icon>
					</view>
				</u-form-item>

				<u-form-item v-if="viewStateBean.chlRebate[0]" :required="viewStateBean.chlRebate[2]" label="渠道返利/元"
					borderBottom>
					<u-input :disabled="!viewStateBean.chlRebate[1]" disabledColor="#ffffff"
						v-model="addbean.plan.chlRebate" type="digit" inputAlign="right" placeholder="请输入"
						border="none"></u-input>
				</u-form-item>

				<u-form-item v-if="viewStateBean.orderDesc[0]" :required="viewStateBean.orderDesc[2]" label="订单备注"
					borderBottom>
					<u-input :disabled="!viewStateBean.orderDesc[1]" disabledColor="#ffffff"
						v-model="addbean.orderCar.orderDesc" inputAlign="right" placeholder="请输入备注信息" border="none">
					</u-input>
				</u-form-item>

				<view v-if="viewStateBean.orderFile[0]" style="display: flex;flex-direction: column;">
					<u-form-item :required="viewStateBean.orderFile[2]" label="订单附件">
						<!-- <view class="car-photo" style="padding: 20rpx 0; display: block;font-size: 30rpx;color: #333;">订单附件</view> -->
					</u-form-item>

					<lr-upload :disabled="!viewStateBean.orderFile[1]" ref="upload1" objType="27" tag="1"
						@on-change="uploadOnChange"></lr-upload>
				</view>

			</u-form>

		</view>

		<view class="item" style="padding: 20rpx 30rpx 0;margin-top: 10rpx;" id="carInfo" v-if="showCarInfo">

			<u-form :model="addbean" ref="uform" label-width="auto">

				<view style="height: 50rpx;display: flex;align-items: center;">
					<u-icon name="order" color="#1573FF" label="车辆信息" label-color="#333333"></u-icon>
				</view>

				<u-form-item label="选择车架号" v-if="viewStateBean.vinNo[0]" :required="viewStateBean.vinNo[2]" borderBottom
					@click="viewStateBean.vinNo[1] && selVin()">
					<u-input v-model="addbean.orderCar.vinNo" inputAlign="right" placeholder="选择车架号" disabled
						disabledColor="#ffffff" border="none"></u-input>
					<view slot="right">
						<u-icon v-if="viewStateBean.vinNo[1]" name="arrow-right"></u-icon>
					</view>
				</u-form-item>

				<u-form-item label="选择车牌号" v-if="viewStateBean.carNo[0]" :required="viewStateBean.carNo[2]" borderBottom
					@click="viewStateBean.carNo[1] && selVin()">
					<u-input v-model="addbean.orderCar.carNo" inputAlign="right" placeholder="选择车牌号" disabled
						disabledColor="#ffffff" border="none"></u-input>
					<view slot="right">
						<u-icon v-if="viewStateBean.carNo[1]" name="arrow-right"></u-icon>
					</view>
				</u-form-item>

				<u-form-item label="车辆归属" v-if="viewStateBean.deptName[0]" :required="viewStateBean.deptName[2]"
					borderBottom>
					<u-input v-model="addbean.orderCar.deptName" inputAlign="right"
						:disabled="!viewStateBean.deptName[1]" disabledColor="#ffffff" border="none" placeholder="自动获取">
					</u-input>
				</u-form-item>

				<u-form-item v-if="viewStateBean.depotName[0]" :required="viewStateBean.depotName[2]" label="车辆仓库"
					borderBottom>
					<u-input v-model="addbean.orderCar.depotName" inputAlign="right"
						:disabled="!viewStateBean.depotName[1]" disabledColor="#ffffff" border="none"
						placeholder="自动获取">
					</u-input>
				</u-form-item>


				<view v-if="viewStateBean.accessoryItems[0]" style="display: flex;flex-direction: column;">

					<u-form-item label="随车物品" :required="viewStateBean.accessoryItems[2]">
					</u-form-item>

					<uni-data-checkbox multiple v-model="accessoryValueList"
						:disabled="!viewStateBean.accessoryItems[1]" :localdata="checkboxList" :map="{
						'value':'value',
						'text':'value'
					}"></uni-data-checkbox>

					<view style="height: 1rpx;background-color: #ebebec;margin-top: 10rpx;">
					</view>

				</view>

				<u-form-item v-if="viewStateBean.carDesc[0]" :required="viewStateBean.carDesc[2]" label="备注">
					<u-input v-model="addbean.orderCar.carDesc" :disabled="!viewStateBean.carDesc[1]"
						disabledColor="#ffffff" inputAlign="right" placeholder="请输入备注" border="none"></u-input>
				</u-form-item>

				<u-form-item v-if="viewStateBean.timeTransferEstimated[0]"
					:required="viewStateBean.timeTransferEstimated[2]" label="预计过户时间"
					@click="viewStateBean.timeTransferEstimated[1] && pickerShow(9)">
					<u-input v-model="addbean.orderCar.timeTransferEstimated" inputAlign="right" placeholder="请选择预计过户时间"
						disabled disabledColor="#ffffff" border="none"></u-input>
					<view slot="right">
						<u-icon v-if="viewStateBean.timeTransferEstimated[1]" name="arrow-right"></u-icon>
					</view>
				</u-form-item>

			</u-form>

		</view>

		<view class="item" style="padding: 20rpx 30rpx 0;margin-top: 10rpx;" id="giveCarInfo" v-if="showGiveCar">

			<u-form :model="addbean" ref="uform" label-width="auto">

				<view style="height: 50rpx;display: flex;align-items: center;">
					<u-icon name="order" color="#1573FF" label="交车信息" label-color="#333333"></u-icon>
				</view>

				<u-form-item label="交车时间" v-if="viewStateBean.timeDelivery[0]" :required="viewStateBean.timeDelivery[2]"
					borderBottom @click="viewStateBean.timeDelivery[1] && pickerShow(6)">
					<u-input v-model="addbean.orderCar.timeDelivery" inputAlign="right" placeholder="选择交车时间" disabled
						disabledColor="#ffffff" border="none"></u-input>
					<view slot="right">
						<u-icon v-if="viewStateBean.timeDelivery[1]" name="arrow-right"></u-icon>
					</view>
				</u-form-item>

				<u-form-item v-if="viewStateBean.deliveryOperationId[0]"
					:required="viewStateBean.deliveryOperationId[2]" label="交车工作人员" borderBottom
					@click="viewStateBean.deliveryOperationId[1] && selGiveMan()">
					<u-input v-model="addbean.orderCar.deliveryOperationName" inputAlign="right" placeholder="选择交车工作人员"
						disabled disabledColor="#ffffff" border="none"></u-input>
					<view slot="right">
						<u-icon v-if="viewStateBean.deliveryOperationId[1]" name="arrow-right"></u-icon>
					</view>
				</u-form-item>

				<u-form-item v-if="viewStateBean.deliveryDesc[0]" :required="viewStateBean.deliveryDesc[2]" label="交车备注"
					borderBottom>
					<u-input v-model="addbean.orderCar.deliveryDesc" :disabled="!viewStateBean.deliveryDesc[1]"
						disabledColor="#ffffff" inputAlign="right" placeholder="请输入备注" border="none"></u-input>
				</u-form-item>

				<view v-if="viewStateBean.deliveryFile[0]" style="display: flex;flex-direction: column;">
					<u-form-item :required="viewStateBean.deliveryFile[2]" label="交车附件">
					</u-form-item>

					<lr-upload :disabled="!viewStateBean.deliveryFile[1]" ref="upload2" objType="8" tag="2"
						@on-change="uploadOnChange"></lr-upload>
				</view>

				<u-form-item v-if="viewStateBean.deliveryMileage[0]" :required="viewStateBean.deliveryMileage[2]"
					label="交车当前里程数/km" borderBottom>
					<u-input :disabled="!viewStateBean.deliveryMileage[1]" disabledColor="#ffffff"
						v-model="addbean.orderCar.deliveryMileage" type="digit" inputAlign="right" placeholder="请输入"
						border="none"></u-input>
				</u-form-item>

				<u-form-item v-if="viewStateBean.mileageNextMaintenance[0]"
					:required="viewStateBean.mileageNextMaintenance[2]" label="下次保养公里数/km" borderBottom>
					<u-input :disabled="!viewStateBean.mileageNextMaintenance[1]" disabledColor="#ffffff"
						v-model="addbean.orderCar.mileageNextMaintenance" type="digit" inputAlign="right"
						placeholder="请输入" border="none"></u-input>
				</u-form-item>

				<u-form-item v-if="viewStateBean.mileageNextDate[0]" :required="viewStateBean.mileageNextDate[2]"
					label="下次保养时间" @click="viewStateBean.mileageNextDate[1] && pickerShow(8)">
					<u-input v-model="addbean.orderCar.mileageNextDate" inputAlign="right" placeholder="请选择" disabled
						disabledColor="#ffffff" border="none"></u-input>
					<view slot="right">
						<u-icon v-if="viewStateBean.mileageNextDate[1]" name="arrow-right"></u-icon>
					</view>
				</u-form-item>

			</u-form>

		</view>

		<view class="item" style="padding: 20rpx 30rpx 0;margin-top: 10rpx;" id="contractInfo" v-if="showContractInfo">

			<u-form :model="addbean" ref="uform" label-width="auto">

				<view style="height: 50rpx;display: flex;align-items: center;">
					<u-icon name="order" color="#1573FF" label="合同信息" label-color="#333333"></u-icon>
				</view>

				<u-form-item v-if="viewStateBean.code[0]" :required="viewStateBean.code[2]" label="选择合同生成方式"
					@click="viewStateBean.code[1] && selContract()">
					<u-input :value="contractStr" inputAlign="right" placeholder="请选择合同生成方式" :disabled="true"
						disabledColor="#ffffff" border="none"></u-input>
					<view slot="right">
						<u-icon v-if="viewStateBean.code[1]" name="arrow-right"></u-icon>
					</view>
				</u-form-item>

			</u-form>

		</view>

		<view class="item" style="padding: 20rpx 30rpx 0;margin-top: 10rpx;" id="examInfo" v-if="showExamInfo">

			<u-form :model="addbean" ref="uform" label-width="auto">

				<view style="height: 50rpx;display: flex;align-items: center;">
					<u-icon name="order" color="#1573FF" label="审核确认" label-color="#333333"></u-icon>
				</view>

				<u-form-item label="请选择订金是否已交" label-width="230" v-if="viewStateBean.isDepositPaid[0]"
					:required="viewStateBean.isDepositPaid[2]" borderBottom>

					<u-radio-group :disabled="!viewStateBean.isDepositPaid[1]"
						v-model="addbean.customFieldMap.isDepositPaid">
						<u-radio :customStyle="{'margin-right': '15rpx'}" shape="circle" label="是" name="1">
							<!-- {{ item.name }} -->
						</u-radio>
						<u-radio :customStyle="{'margin-right': '15rpx'}" shape="circle" label="否" name="0">
							<!-- {{ item.name }} -->
						</u-radio>
					</u-radio-group>
				</u-form-item>

				<u-form-item label="请选择是否已上牌" label-width="230" v-if="viewStateBean.isCarNoRegistered[0]"
					:required="viewStateBean.isCarNoRegistered[2]" borderBottom>

					<u-radio-group :disabled="!viewStateBean.isCarNoRegistered[1]"
						v-model="addbean.customFieldMap.isCarNoRegistered">
						<u-radio :customStyle="{'margin-right': '15rpx'}" shape="circle" label="是" name="1">
							<!-- {{ item.name }} -->
						</u-radio>
						<u-radio :customStyle="{'margin-right': '15rpx'}" shape="circle" label="否" name="0">
							<!-- {{ item.name }} -->
						</u-radio>
					</u-radio-group>
				</u-form-item>

				<u-form-item label="请选择保险是否已确认" label-width="230" v-if="viewStateBean.isInsuranceConfirmed[0]"
					:required="viewStateBean.isInsuranceConfirmed[2]" borderBottom>

					<u-radio-group :disabled="!viewStateBean.isInsuranceConfirmed[1]"
						v-model="addbean.customFieldMap.isInsuranceConfirmed">
						<u-radio :customStyle="{'margin-right': '15rpx'}" shape="circle" label="是" name="1">
							<!-- {{ item.name }} -->
						</u-radio>
						<u-radio :customStyle="{'margin-right': '15rpx'}" shape="circle" label="否" name="0">
							<!-- {{ item.name }} -->
						</u-radio>
					</u-radio-group>
				</u-form-item>

				<u-form-item label="请选择合同是否已确认" label-width="230" v-if="viewStateBean.isContractConfirmed[0]"
					:required="viewStateBean.isContractConfirmed[2]" borderBottom>

					<u-radio-group :disabled="!viewStateBean.isContractConfirmed[1]"
						v-model="addbean.customFieldMap.isContractConfirmed">
						<u-radio :customStyle="{'margin-right': '15rpx'}" shape="circle" label="是" name="1">
							<!-- {{ item.name }} -->
						</u-radio>
						<u-radio :customStyle="{'margin-right': '15rpx'}" shape="circle" label="否" name="0">
							<!-- {{ item.name }} -->
						</u-radio>
					</u-radio-group>
				</u-form-item>

				<u-form-item label="请确认财务是否已收款确认" label-width="230" v-if="viewStateBean.isReceivedPayment[0]"
					:required="viewStateBean.isReceivedPayment[2]" borderBottom>

					<u-radio-group :disabled="!viewStateBean.isReceivedPayment[1]"
						v-model="addbean.customFieldMap.isReceivedPayment">
						<u-radio :customStyle="{'margin-right': '15rpx'}" shape="circle" label="是" name="1">
							<!-- {{ item.name }} -->
						</u-radio>
						<u-radio :customStyle="{'margin-right': '15rpx'}" shape="circle" label="否" name="0">
							<!-- {{ item.name }} -->
						</u-radio>
					</u-radio-group>
				</u-form-item>


				<u-form-item v-if="viewStateBean.paymentMethod[0]" :required="viewStateBean.paymentMethod[2]"
					label="收款方式" borderBottom>
					<u-input v-model="addbean.customFieldMap.paymentMethod" disabledColor="#ffffff"
						:disabled="!viewStateBean.paymentMethod[1]" inputAlign="right" placeholder="请输入" border="none">
					</u-input>
				</u-form-item>

				<u-form-item v-if="viewStateBean.collectBalance[0]" :required="viewStateBean.collectBalance[2]"
					label="待收尾款(元)" borderBottom>
					<u-input v-model="addbean.customFieldMap.collectBalance" disabledColor="#ffffff"
						:disabled="!viewStateBean.collectBalance[1]" type="digit" inputAlign="right" placeholder="请输入"
						border="none"></u-input>
				</u-form-item>

				<u-form-item v-if="viewStateBean.loanAmount[0]" :required="viewStateBean.loanAmount[2]" label="放款金额(元)"
					borderBottom>
					<u-input v-model="addbean.customFieldMap.loanAmount" disabledColor="#ffffff"
						:disabled="!viewStateBean.loanAmount[1]" type="digit" inputAlign="right" placeholder="请输入"
						border="none"></u-input>
				</u-form-item>


			</u-form>

		</view>


		<view style="height: 100rpx;"></view>

		<view class="button-container" v-if="buttonList.length>0">
			<button class="btn-item" v-for="(bitem, bindex) in buttonList" :key="bindex"
				@click="bottomClick(bitem)">{{bitem.btnName}}</button>
		</view>

		<!-- 还款方式 -->
		<u-picker :show="paymethodShow" :default-selector="[0]" :columns="paymethodList" keyName="value"
			@confirm="pickerConfim" @cancel="paymethodShow=false"></u-picker>

		<!-- 品牌车型 -->
		<u-picker :mode="mode" :show="carInfoShow" :default-selector="[0]" :columns="carInfoList"
			keyName="brandSeriesModel" @confirm="pickerConfim" @cancel="carInfoShow=false"></u-picker>

		<!-- 还款日 -->
		<u-picker :mode="mode" :show="payDayShow" :default-selector="[0]" :columns="paydayList" keyName="mValue"
			@confirm="pickerConfim" @cancel="payDayShow=false"></u-picker>

		<!-- 还款时间 -->
		<u-datetime-picker :show="payTimeShow" mode="date" @confirm="timeConfirm" @cancel="payTimeShow=false">
		</u-datetime-picker>

		<!-- 租期开始时间 -->
		<u-datetime-picker :show="rentStartShow" v-model="value1" :maxDate="value2" mode="date" @confirm="timeConfirm"
			@cancel="rentStartShow=false"></u-datetime-picker>

		<!-- 租期结束时间 -->
		<u-datetime-picker :show="rentEndShow" v-model="value2" :minDate="value1" mode="date" @confirm="timeConfirm"
			@cancel="rentEndShow=false"></u-datetime-picker>

		<!-- 交车时间 -->
		<u-datetime-picker :show="giveTimeShow" mode="date" @confirm="timeConfirm" @cancel="giveTimeShow=false">
		</u-datetime-picker>

		<!-- 下次保养时间 -->
		<u-datetime-picker :show="nextTimeShow" mode="date" @confirm="timeConfirm" @cancel="nextTimeShow=false">
		</u-datetime-picker>

		<!-- 预计过户时间 -->
		<u-datetime-picker :show="transferTimeShow" mode="date" @confirm="timeConfirm" @cancel="transferTimeShow=false">
		</u-datetime-picker>

		<!-- 车辆归属 -->
		<gljyDataPicker class="deptPicker" ref="picker" :idkey="'deptId'" :isSuper="true" namekey="deptName"
			:childrenkey="'subDeptList'" :title="'请选择'" :initList="deptList" @itemOnclick="itemOnclickDept">
		</gljyDataPicker>

	</view>
</template>

<script>
	import gljyDataPicker from "@/components/gljy-data-picker/gljy-data-picker.vue";
	import lrUpload from '@/components/global/lr-upload.vue'
  import {isVideo} from "@/common/calc";
	export default {
		components: {
			lrUpload,
			gljyDataPicker,
		},
		data() {
			return {
				value1: Number(new Date()),
				value2: Number(new Date()) + 12 * 30 * 24 * 3600 * 1000,
				contractStr: '',
				oldData: {},
				customFieldMapBean: '',
				showExamInfo: true,
				showContractInfo: true,
				showCarInfo: true,
				showCarOrderInfo: true,
				showBaseInfo: true,
				showGiveCar: true,
				buttonList: [],
				list: [],
				addbean: {
					contract: {
						contractType: 0,
						timeFinish: '',
						timeStart: ''
					},
					orderCar: {
						paymentDayType: 1,
						timeRepayment: '',
						orderFileLst: [],
						id: '',
						code: '',
						orderId: '',
						carId: '',
						carNo: '',
						vinNo: '',
						deptId: '',
						deptName: '',
						depotId: '',
						depotName: '',
						cityId: '',
						cityName: '',
						mileage: '',
						electricQuantity: '',
						accessoryItemsName: '',
						accessoryItems: '',
						carDesc: '',
						orderDesc: '',
						deliveryOperationId: '',
						deliveryOperationName: '',
						deliveryMileage: '',
						mileageNextMaintenance: '',
						mileageNextDate: '',
						deliveryDesc: '',
						timeDelivery: '',
						timeTransferEstimated: '',
						deliveryFileLst: [],

					},
					plan: {
						paymentMethod: '',
						paymentMethodName: '',
						rentType: 0,
						rentTypeName: '',
						brandSeriesModel: '',
						brandId: '',
						brandName: '',
						seriesId: '',
						seriesName: '',
						modelId: '',
						modelName: '',
						cashDeposit: '',
						downPayment: '',
						balancePayment: '',
						monthlyRent: '',
						repaymentMethods: '',
						financeCompanyName: '',
						chlRebate: '',
						freeDays: '',
						desc: '',
						insuranceItems: '',
						paymentDay: '',
						channelId: '',
						channelName: '',
						timeStartRent: '',
						timeFinishRent: '',
						tenancy: '',
						tenancyType: 1,
						servicingFee: '',
						totalPrice: '',
						coverCharge: '',
						balancePaymentLst: [],

					},
					bpmChartDtoList: [],
					customFieldMap: {
						isInsuranceConfirmed: '',
						isCarNoRegistered: '',
						isReceivedPayment: '',
						isContractConfirmed: '',
						isDepositPaid: '',
						paymentMethod: '',
						collectBalance: '',
						loanAmount: '',
					},
					lessorId: '',
					lessorName: '',
					customerId: '',
					customerType: '',
					customerName: '',
					customerAddr: '',
					customerTel: '',
				},
				//随车物品
				checkboxList: [],
				//已购保险
				insuranceList: [],
				value: [],
				intentData: {},
				querychoice: {},
				defaultOrderId: '',
				pickerType: 0,
				//还款方式
				paymethodShow: false,
				paymethodList: [],
				//车辆归属
				deptList: [],
				//品牌车型
				carInfoShow: false,
				carInfoList: [],
				//还款日
				paydayList: [],
				payDayShow: false,
				payDayStr: '',
				balancestr: '',
				payTimeShow: false,
				rentStartShow: false,
				rentEndShow: false,
				giveTimeShow: false,
				nextTimeShow: false,
				transferTimeShow: false,
				insuranceValueList: [],
				accessoryValueList: [],
				viewStateBean: {
					lessorId: [false, false, false],
					customerId: [false, false, false],
					customerName: [false, false, false],
					customerAddr: [false, false, false],
					customerTel: [false, false, false],
					rentType: [false, false, false],
					selectCarModel: [false, false, false],
					downPayment: [false, false, false],
					cashDeposit: [false, false, false],
					servicingFee: [false, false, false],
					totalPrice: [false, false, false],
					monthlyRent: [false, false, false],
					hasBalancePayment: [false, false, false],
					financeCompanyName: [false, false, false],
					freeDays: [false, false, false],
					coverCharge: [false, false, false],
					repaymentMethods: [false, false, false],
					paymentDay: [false, false, false],
					timeRepayment: [false, false, false],
					insuranceItems: [false, false, false],
					timeStartRent: [false, false, false],
					timeFinishRent: [false, false, false],
					tenancy: [false, false, false],
					channel: [false, false, false],
					chlRebate: [false, false, false],
					orderDesc: [false, false, false],
					orderFile: [false, false, false],
					vinNo: [false, false, false],
					carNo: [false, false, false],
					deptName: [false, false, false],
					depotName: [false, false, false],
					accessoryItems: [false, false, false],
					carDesc: [false, false, false],
					timeTransferEstimated: [false, false, false],
					timeDelivery: [false, false, false],
					deliveryOperationId: [false, false, false],
					deliveryDesc: [false, false, false],
					deliveryFile: [false, false, false],
					deliveryMileage: [false, false, false],
					mileageNextMaintenance: [false, false, false],
					mileageNextDate: [false, false, false],
					isDepositPaid: [false, false, false],
					isCarNoRegistered: [false, false, false],
					isInsuranceConfirmed: [false, false, false],
					isContractConfirmed: [false, false, false],
					isReceivedPayment: [false, false, false],
					paymentMethod: [false, false, false],
					collectBalance: [false, false, false],
					loanAmount: [false, false, false],

				},
			}
		},

		methods: {
			getcontractStr() {

				// console.log('this.addbean.contract==>', this.addbean.contract);

				if (!uni.$u.test.isEmpty(this.addbean.contract)) {

					if (2 == this.addbean.contract.contractType) {
						return uni.$u.test.isEmpty(this.addbean.contract.templateId) ? '' : '已选择根据订单自动生成合同'
					} else if (1 == this.addbean.contract.contractType) {
						return !uni.$u.test.isEmpty(this.addbean.contract.code) ||
							!uni.$u.test.isEmpty(this.addbean.contract.timeStart) ||
							!uni.$u.test.isEmpty(this.addbean.contract.timeFinish) ||
							!uni.$u.test.isEmpty(this.addbean.contract.desc) ||
							!uni.$u.test.isEmpty(this.addbean.contract.fileLst) ?
							'已选择填写合同信息' : ''
					} else {
						return ''
					}
				} else {
					return ''
				}

			},

			selContract() {

				getApp().globalData.addOrderContract = this.addbean.contract
				getApp().globalData.initialData = this.oldData

				uni.navigateTo({
					url: '/pagesB/contract/add-contract-type?type=' + this.addbean.plan.rentType
				})
			},

			setViewState() {
				let that = this

				//处理动态数据
				if (!uni.$u.test.isEmpty(that.list)) {
					for (let module of that.list) {
						switch (module.moduleInfo) {
							case 'billLading':
								//提单
								for (let field of module.fields) {
									if ('paymentMethod' == field.fieldInfo) {
										that.viewStateBean.repaymentMethods = [!field.hide, field.edit, field.required]
									} else {
										that.viewStateBean[field.fieldInfo] = [!field.hide, field.edit, field.required]
									}

									// switch(field.fieldInfo){
									// 	case 'lessorId':

									// 		break
									// 	case 'customerId':

									// 		break
									// }
								}
								break
							case 'vehicleBusiness':
								//车辆
								for (let field of module.fields) {

									that.viewStateBean[field.fieldInfo] = [!field.hide, field.edit, field.required]

								}
								break
							case 'payCarBusiness':
								//交车
								for (let field of module.fields) {

									that.viewStateBean[field.fieldInfo] = [!field.hide, field.edit, field.required]

								}
								break
							case 'contractBusiness':
								//合同
								for (let field of module.fields) {

									that.viewStateBean[field.fieldInfo] = [!field.hide, field.edit, field.required]

								}
								break
							case 'customField':
								//审核相关
								for (let field of module.fields) {

									that.viewStateBean[field.fieldInfo] = [!field.hide, field.edit, field.required]

								}
								break
						}
					}
				}

				this.$forceUpdate()

				console.log('that.viewStateBean=============>', that.viewStateBean);

				const query = uni.createSelectorQuery().in(this);

				setTimeout(() => {
					query.select('#baseInfo').boundingClientRect(data => {
						console.log("baseInfo得到布局位置信息" + JSON.stringify(data));
						that.showBaseInfo = data.height > 43
					}).exec();

					query.select('#carOrderInfo').boundingClientRect(data => {
						console.log("carOrderInfo得到布局位置信息" + JSON.stringify(data));
						that.showCarOrderInfo = data.height > 43
					}).exec();

					query.select('#carInfo').boundingClientRect(data => {
						console.log("carInfo得到布局位置信息" + JSON.stringify(data));
						that.showCarInfo = data.height > 43
					}).exec();

					query.select('#giveCarInfo').boundingClientRect(data => {
						console.log("giveCarInfo得到布局位置信息" + JSON.stringify(data));

						that.showGiveCar = data.height > 43

					}).exec();

					query.select('#contractInfo').boundingClientRect(data => {
						console.log("contractInfo得到布局位置信息" + JSON.stringify(data));
						that.showContractInfo = data.height > 43
					}).exec();

					query.select('#examInfo').boundingClientRect(data => {
						console.log("examInfo得到布局位置信息" + JSON.stringify(data));
						that.showExamInfo = data.height > 43
					}).exec();

				}, 1500)

			},

			selLessor() {
				this.$refs.picker._show();
			},

			selCustomer() {
				uni.navigateTo({
					url: '/pages/customer/customer-center?type=select'
				})
			},
			addFinalFee() {

				var intentData = JSON.stringify(this.addbean.plan.balancePaymentLst);
				uni.navigateTo({
					url: '/pagesB/addorder/add-finalfee?balancePaymentLst=' + intentData
				})
			},

			bottomClick(bitem) {
				//btnkey含义
				//提单审核通过:302
				//提单审核驳回:303
				//提单审核拒绝:304
				//提单审核撤回:305
				//提单审核删除:306
				//暂存 9
				//提交 10

				switch (bitem.btnKey) {
					case '302': //校验必填后通过，此页面数据带到下个页面提交
						this.saveData(4)
						break
					case '303':
						uni.redirectTo({
							url: '/pagesB/exam-order/exam-order?type=2&orderId=' + this.addbean.orderCar.orderId
						})
						break
					case '304':
						uni.redirectTo({
							url: '/pagesB/exam-order/exam-order?type=1&orderId=' + this.addbean.orderCar.orderId
						})
						break
					case '305':
						uni.redirectTo({
							url: '/pagesB/exam-order/exam-order?type=5&orderId=' + this.addbean.orderCar.orderId
						})
						break
					case '306':
						uni.redirectTo({
							url: '/pagesB/exam-order/exam-order?type=6&orderId=' + this.addbean.orderCar.orderId
						})
						break
					case '9':
						this.saveData(8)
						break
					case '10':
						if (!uni.$u.test.isEmpty(this.defaultOrderId)) {
							//编辑后提交
							this.saveData(10);
						} else {
							//直接提交
							this.saveData(9);
						}


						break

						// case 1:
						// 	this.saveData(1)
						// break
						// case 2:
						// 	if(uni.$u.test.isEmpty(this.defaultOrderId)){
						// 		//新增
						// 		this.saveData(2)
						// 	}else{
						// 		//编辑
						// 		this.saveData(3)
						// 	}
						// break
				}
			},

			//type含义 1拒绝  2驳回   3列表直接通过    4编辑后通过  5撤回   6删除   7审核页面直接通过
			//8暂存  9直接提交   10编辑后提交
			saveData(atype) {
				this.addbean.plan.insuranceItems = this.insuranceValueList.join(',')
				this.addbean.orderCar.accessoryItemsName = this.accessoryValueList.join(',')

				let that = this

				console.log('this.addbean===>', this.addbean)

				if (8 != atype) { //暂存不需要校验任何一条
					if (this.viewStateBean.lessorId[2] && uni.$u.test.isEmpty(this.addbean.lessorId)) {
						this.$u.toast('请选择出租方')
						return
					}

					if (this.viewStateBean.customerId[2] && uni.$u.test.isEmpty(this.addbean.customerId)) {
						this.$u.toast('请选择客户')
						return
					}

					if (this.viewStateBean.customerName[2] && uni.$u.test.isEmpty(this.addbean.customerName)) {
						this.$u.toast('客户名称不能为空')
						return
					}

					if (this.viewStateBean.customerAddr[2] && uni.$u.test.isEmpty(this.addbean.customerAddr)) {
						this.$u.toast('联系地址不能为空')
						return
					}

					if (this.viewStateBean.customerTel[2] && uni.$u.test.isEmpty(this.addbean.customerTel)) {
						this.$u.toast('联系电话不能为空')
						return
					}

					if (this.viewStateBean.rentType[2] && uni.$u.test.isEmpty(this.addbean.plan.rentType)) {
						this.$u.toast('租赁类型不能为空')
						return
					}

					if (this.viewStateBean.selectCarModel[2] && uni.$u.test.isEmpty(this.addbean.plan.modelId)) {
						this.$u.toast('请选择品牌/车系/车型')
						return
					}

					if (this.viewStateBean.downPayment[2] && uni.$u.test.isEmpty(this.addbean.plan.downPayment)) {
						this.$u.toast('请输入首付款')
						return
					}

					if (this.viewStateBean.cashDeposit[2] && uni.$u.test.isEmpty(this.addbean.plan.cashDeposit)) {
						this.$u.toast('请输入保证金')
						return
					}

					if (this.viewStateBean.servicingFee[2] && uni.$u.test.isEmpty(this.addbean.plan.servicingFee)) {
						this.$u.toast('请输入整备费')
						return
					}

					if (this.viewStateBean.totalPrice[2] && uni.$u.test.isEmpty(this.addbean.plan.totalPrice)) {
						this.$u.toast('请输入车辆总单价')
						return
					}

					if (this.viewStateBean.monthlyRent[2] && uni.$u.test.isEmpty(this.addbean.plan.monthlyRent)) {
						this.$u.toast('请输入月租金')
						return
					}

					if (this.viewStateBean.hasBalancePayment[2] && uni.$u.test.isEmpty(this.addbean.plan
						.balancePaymentLst)) {
						this.$u.toast('请添加尾款')
						return
					}

					if (this.viewStateBean.financeCompanyName[2] && uni.$u.test.isEmpty(this.addbean.plan
							.financeCompanyName)) {
						this.$u.toast('请输入金融公司名称')
						return
					}

					if (this.viewStateBean.freeDays[2] && uni.$u.test.isEmpty(this.addbean.plan.freeDays)) {
						this.$u.toast('请输入免费用车天数')
						return
					}

					if (this.viewStateBean.coverCharge[2] && uni.$u.test.isEmpty(this.addbean.plan.coverCharge)) {
						this.$u.toast('请输入服务费')
						return
					}

					if (this.viewStateBean.repaymentMethods[2] && uni.$u.test.isEmpty(this.addbean.plan.paymentMethod)) {
						this.$u.toast('请选择还款方式')
						return
					}

					if (this.viewStateBean.paymentDay[2]) {
						if (!uni.$u.test.isEmpty(this.addbean.orderCar.paymentDayType)) {
							if (2 == this.addbean.orderCar.paymentDayType) {
								if (uni.$u.test.isEmpty(this.addbean.plan.paymentDay)) {
									this.$u.toast("请选择还款日");
									return;
								}
							}
						} else {
							this.$u.toast("请选择还款日类型");
							return;
						}
					}

					if (this.viewStateBean.timeRepayment[2] && uni.$u.test.isEmpty(this.addbean.orderCar.timeRepayment)) {
						this.$u.toast('请选择还款时间')
						return
					}

					if (this.viewStateBean.insuranceItems[2] && uni.$u.test.isEmpty(this.addbean.plan.insuranceItems)) {
						this.$u.toast('请选择车辆已购保险')
						return
					}

					//int rentViewType;// 1两个租期都有  2只有租期区间   3只有租期期限   4两个都没有
					//时间区间
					if (this.viewStateBean.timeStartRent[2] || this.viewStateBean.timeFinishRent[2]) {
						if (uni.$u.test.isEmpty(this.addbean.plan.timeStartRent) || uni.$u.test.isEmpty(this.addbean.plan
								.timeFinishRent)) {
							this.$u.toast("请选择租期时间区间");
							return;
						}
					}

					if (this.viewStateBean.tenancy[2] && uni.$u.test.isEmpty(this.addbean.plan.tenancy)) {
						this.$u.toast('请输入租期期限')
						return
					}

					if (this.viewStateBean.channel[2] && uni.$u.test.isEmpty(this.addbean.plan.channelId)) {
						this.$u.toast('请选择所属渠道商')
						return
					}

					if (this.viewStateBean.chlRebate[2] && uni.$u.test.isEmpty(this.addbean.plan.chlRebate)) {
						this.$u.toast('请输入渠道返利')
						return
					}

					if (this.viewStateBean.orderDesc[2] && uni.$u.test.isEmpty(this.addbean.orderCar.orderDesc)) {
						this.$u.toast('请输入订单备注')
						return
					}

					if (this.viewStateBean.orderFile[2] && uni.$u.test.isEmpty(this.addbean.orderCar.orderFileLst)) {
						this.$u.toast('请上传订单附件')
						return
					}

					//车辆模块
					if (this.viewStateBean.vinNo[2] && uni.$u.test.isEmpty(this.addbean.orderCar.vinNo)) {
						this.$u.toast('车架号不能为空')
						return
					}

					if (this.viewStateBean.carNo[2] && uni.$u.test.isEmpty(this.addbean.orderCar.carNo)) {
						this.$u.toast('车牌号不能为空')
						return
					}

					if (this.viewStateBean.deptName[2] && uni.$u.test.isEmpty(this.addbean.orderCar.deptName)) {
						this.$u.toast('车辆归属不能为空')
						return
					}

					if (this.viewStateBean.depotName[2] && uni.$u.test.isEmpty(this.addbean.orderCar.depotName)) {
						this.$u.toast('车辆仓库不能为空')
						return
					}

					if (this.viewStateBean.accessoryItems[2] && uni.$u.test.isEmpty(this.addbean.orderCar
							.accessoryItemsName)) {
						this.$u.toast('请选择随车物品')
						return
					}

					if (this.viewStateBean.carDesc[2] && uni.$u.test.isEmpty(this.addbean.orderCar.carDesc)) {
						this.$u.toast('请输入车辆备注')
						return
					}

					if (this.viewStateBean.timeTransferEstimated[2] && uni.$u.test.isEmpty(this.addbean.orderCar
							.timeTransferEstimated)) {
						this.$u.toast('请选择预计过户时间')
						return
					}

					//交车信息
					if (this.viewStateBean.timeDelivery[2] && uni.$u.test.isEmpty(this.addbean.orderCar.timeDelivery)) {
						this.$u.toast('请选择交车时间')
						return
					}

					if (this.viewStateBean.deliveryOperationId[2] && uni.$u.test.isEmpty(this.addbean.orderCar
							.deliveryOperationName)) {
						this.$u.toast('请选择交车工作人员')
						return
					}

					if (this.viewStateBean.deliveryDesc[2] && uni.$u.test.isEmpty(this.addbean.orderCar.deliveryDesc)) {
						this.$u.toast('请输入交车备注')
						return
					}

					if (this.viewStateBean.deliveryFile[2] && uni.$u.test.isEmpty(this.addbean.orderCar.deliveryFileLst)) {
						this.$u.toast('请上传交车附件')
						return
					}

					if (this.viewStateBean.deliveryMileage[2] && uni.$u.test.isEmpty(this.addbean.orderCar
						.deliveryMileage)) {
						this.$u.toast('请输入交车当前里程数')
						return
					}

					if (this.viewStateBean.mileageNextMaintenance[2] && uni.$u.test.isEmpty(this.addbean.orderCar
							.mileageNextMaintenance)) {
						this.$u.toast('请输入下次保养里程数')
						return
					}

					if (this.viewStateBean.mileageNextDate[2] && uni.$u.test.isEmpty(this.addbean.orderCar
						.mileageNextDate)) {
						this.$u.toast('请选择下次保养时间')
						return
					}

					//审核模块
					if (this.viewStateBean.isDepositPaid[2] && uni.$u.test.isEmpty(this.addbean.customFieldMap
							.isDepositPaid)) {
						this.$u.toast('请选择订金是否已交')
						return
					}

					if (this.viewStateBean.isCarNoRegistered[2] && uni.$u.test.isEmpty(this.addbean.customFieldMap
							.isCarNoRegistered)) {
						this.$u.toast('请选择是否已上牌')
						return
					}

					if (this.viewStateBean.isInsuranceConfirmed[2] && uni.$u.test.isEmpty(this.addbean.customFieldMap
							.isInsuranceConfirmed)) {
						this.$u.toast('请选择保险是否已确认')
						return
					}

					if (this.viewStateBean.isContractConfirmed[2] && uni.$u.test.isEmpty(this.addbean.customFieldMap
							.isContractConfirmed)) {
						this.$u.toast('请选择合同是否已确认')
						return
					}

					if (this.viewStateBean.isReceivedPayment[2] && uni.$u.test.isEmpty(this.addbean.customFieldMap
							.isReceivedPayment)) {
						this.$u.toast('请确认财务是否已收款确认')
						return
					}

					if (this.viewStateBean.paymentMethod[2] && uni.$u.test.isEmpty(this.addbean.customFieldMap
							.paymentMethod)) {
						this.$u.toast('请输入收款方式')
						return
					}

					if (this.viewStateBean.collectBalance[2] && uni.$u.test.isEmpty(this.addbean.customFieldMap
							.collectBalance)) {
						this.$u.toast('请输入待收尾款')
						return
					}

					if (this.viewStateBean.loanAmount[2] && uni.$u.test.isEmpty(this.addbean.customFieldMap.loanAmount)) {
						this.$u.toast('请输入放款金额')
						return
					}

				}


				// 4编辑后通过 8暂存  9直接提交   10编辑后提交
        let addbean = uni.$u.deepClone(that.addbean);
        addbean.plan.monthlyRent = Number(that.addbean.plan.monthlyRent).add(that.addbean.plan.coverCharge||0)

				if (4 == atype) {
					getApp().globalData.exam_order = addbean
					uni.redirectTo({
						url: '/pagesB/exam-order/exam-order?type=4&orderId=' + addbean.orderCar.orderId
					})
				} else if (8 == atype) {
					uni.showModal({
						content: '确定提交吗?',
						success(res) {
							if (res.confirm) {
                uni.showLoading()
								that.$u.api.orderActivityTemporarystorage(addbean).then(res => {
                  uni.hideLoading()
									uni.$emit('refreshOrder', true)
									that.$u.toast('提交成功')
									setTimeout(() => {
										uni.navigateBack()
									}, 1000)
								}).catch(e=>{
                  uni.hideLoading()
                })
							}
						}
					})
				} else if (9 == atype) {
					uni.showModal({
						content: '确定提交吗?',
						success(res) {
							if (res.confirm) {
                uni.showLoading()
								that.$u.api.orderActivityAdd(addbean).then(res => {
                  uni.hideLoading()
									uni.$emit('refreshOrder', true)
									that.$u.toast('提交成功')
									setTimeout(() => {
										uni.navigateBack()
									}, 1000)
								}).catch(e=>{
                  uni.hideLoading()
                })
							}
						}
					})
				} else if (10 == atype) {
					uni.showModal({
						content: '确定提交吗?',
						success(res) {
							if (res.confirm) {
                uni.showLoading()
								that.$u.api.orderActivityEdit(addbean).then(res => {
                  uni.hideLoading()
									uni.$emit('refreshOrder', true)
									that.$u.toast('提交成功')
									setTimeout(() => {
										uni.navigateBack()
									}, 1000)
								}).catch(e=>{
                  uni.hideLoading()
                })
							}
						}
					})
				}
			},

			goSelChannel() {
				uni.navigateTo({
					url: '/pagesA/channel/sel-channel?type=2'
				})
			},

			selVin() {
				if (uni.$u.test.isEmpty(this.addbean.lessorId)) {
					this.$u.toast('请选择出租方')
					return
				}

				if (uni.$u.test.isEmpty(this.addbean.plan.modelId)) {
					this.$u.toast('请选择品牌/车型/车系')
					return
				}

				uni.navigateTo({
					url: '/pages/car/allocation/car-carlist?modelId=' + this.addbean.plan.modelId + '&depotId=' +
						this.addbean.orderCar.depotId + '&deptId=' + this.addbean.lessorId+'&type=10'
				})

			},

			selGiveMan() {
				uni.navigateTo({
					url: '/pages/customer/buss_owner_list'
				})
			},

			//图片上传成功回调
			uploadOnChange(tag, resultList, resultObjList) {
				console.log(tag, resultList, resultObjList);
				switch (tag) {
					case '1': //订单附件

						this.addbean.orderCar.orderFileLst = resultObjList;
						break

					case '2': //交车附件

						this.addbean.orderCar.deliveryFileLst = resultObjList;
						break


				}
			},

			//车辆归属选择回调事件
			itemOnclickDept(res) {

				if (res.deptId != this.addbean.lessorId) {
					//重置其他条件
					this.addbean.orderCar.carId = ''
					this.addbean.orderCar.carNo = ''
					this.addbean.orderCar.vinNo = ''
					this.addbean.orderCar.deptId = ''
					this.addbean.orderCar.deptName = ''
					this.addbean.orderCar.depotId = ''
					this.addbean.orderCar.depotName = ''
					this.addbean.orderCar.cityId = ''
					this.addbean.orderCar.cityName = ''
					this.accessoryValueList = []

				}

				this.addbean.lessorName = res.deptName;
				this.addbean.lessorId = res.deptId;

				console.log(this.addbean.lessorName);
			},

			//picker是否显示
			pickerShow(type) {
				switch (type) {
					case 1:
						this.paymethodShow = true;
						break
					case 2:
						this.carInfoShow = true;
						break
					case 3:
						this.payDayShow = true;
						break
					case 4:
						this.rentStartShow = true;
						break
					case 5:
						this.rentEndShow = true;
						break
					case 6:
						this.giveTimeShow = true;
						break
					case 7:
						this.payTimeShow = true;
						break
					case 8:
						this.nextTimeShow = true;
						break
					case 9:
						this.transferTimeShow = true;
						break
				}
				this.pickerType = type;
			},

			timeConfirm(e) {
				let timeStr = uni.$u.timeFormat(e.value, 'yyyy-mm-dd');

				switch (this.pickerType) {
					case 4: //租期开始时间
						this.rentStartShow = false;
						this.addbean.plan.timeStartRent = timeStr;
						break
					case 5: //租期结束时间
						this.rentEndShow = false;
						this.addbean.plan.timeFinishRent = timeStr;
						break
					case 6: //交车时间
						this.giveTimeShow = false;
						this.addbean.orderCar.timeDelivery = timeStr;
						break
					case 7: //还款时间
						this.payTimeShow = false;
						this.addbean.orderCar.timeRepayment = timeStr;
						break
					case 8: //下次保养时间
						this.nextTimeShow = false;
						this.addbean.orderCar.mileageNextDate = timeStr;
						break
					case 9: //预计过户时间
						this.transferTimeShow = false;
						this.addbean.orderCar.timeTransferEstimated = timeStr;
						break
				}
			},

			//picker回调函数
			pickerConfim(e) {
				switch (this.pickerType) {
					case 1: //还款方式
						this.paymethodShow = false;
						// let carInfoObjc = this.carInfoList[index];
						let paymethodObjc = e.value[0];

						this.addbean.plan.paymentMethod = paymethodObjc.code;
						this.addbean.plan.paymentMethodName = paymethodObjc.value;

						break

					case 2: //车辆
						this.carInfoShow = false;
						// let carInfoObjc = this.carInfoList[index];
						let carInfoObjc = e.value[0];

						if (carInfoObjc.modelId != this.addbean.plan.modelId) {
							this.addbean.orderCar.carId = ''
							this.addbean.orderCar.carNo = ''
							this.addbean.orderCar.vinNo = ''
							this.addbean.orderCar.deptId = ''
							this.addbean.orderCar.deptName = ''
							this.addbean.orderCar.depotId = ''
							this.addbean.orderCar.depotName = ''
							this.addbean.orderCar.cityId = ''
							this.addbean.orderCar.cityName = ''
							this.accessoryValueList = []
						}


						this.addbean.plan.brandId = carInfoObjc.brandId;
						this.addbean.plan.brandName = carInfoObjc.brandName;
						this.addbean.plan.seriesId = carInfoObjc.seriesId;
						this.addbean.plan.seriesName = carInfoObjc.seriesName;
						this.addbean.plan.modelId = carInfoObjc.modelId;
						this.addbean.plan.modelName = carInfoObjc.modelName;
						this.addbean.plan.brandSeriesModel = carInfoObjc.brandSeriesModel;

						break

					case 3: //还款日
						this.payDayShow = false;

						this.addbean.plan.paymentDay = e.value[0].code;
						this.payDayStr = e.value[0].mValue;
						break

					case 4: //有无侧门
						this.carSideShow = false;
						// let sideDoorObjc = this.sideList[index];
						let sideDoorObjc = e.value[0];
						this.vehicle.sideDoor = sideDoorObjc.code;
						this.vehicle.sideDoorStr = sideDoorObjc.code == 1 ? '有' : '无';
						break

					case 5: //车辆仓库
						this.carWarehouseShow = false;
						// let warehouseObjc = this.carWarehouseList[index];
						let warehouseObjc = e.value[0];
						this.vehicle.depotName = warehouseObjc.warehouseName;
						this.vehicle.depotId = warehouseObjc.warehouseId;
						break
				}
			},

			//旧数据回显
			handleOldData(res) {

				console.log('老数据', res);

				this.oldData = res;

				if (!uni.$u.test.isEmpty(res) && !uni.$u.test.isEmpty(res.bizData)) {
					this.addbean = res.bizData

          this.addbean.plan.monthlyRent = Number(this.addbean.plan.monthlyRent).sub(this.addbean.plan.coverCharge||0)
				}

				if (!uni.$u.test.isEmpty(res) && !uni.$u.test.isEmpty(res.list)) {
					this.list = res.list
				}

				if (!uni.$u.test.isEmpty(res) && !uni.$u.test.isEmpty(res.buttonList)) {
					this.buttonList = res.buttonList
				}


				//1经租  2以租代购  3展示车  4试驾车  5融租  6直购
				this.addbean.plan.rentTypeName = 1 == this.addbean.plan.rentType ? "经租" :
					2 == this.addbean.plan.rentType ? "以租代购" :
					3 == this.addbean.plan.rentType ? "展示车" :
					4 == this.addbean.plan.rentType ? "试驾车" :
					5 == this.addbean.plan.rentType ? "融租" :
					6 == this.addbean.plan.rentType ? "直购" :
					''

				if (!uni.$u.test.isEmpty(this.addbean.plan.brandName) &&
					!uni.$u.test.isEmpty(this.addbean.plan.seriesName) &&
					!uni.$u.test.isEmpty(this.addbean.plan.modelName)) {
					this.addbean.plan.brandSeriesModel = this.addbean.plan.brandName + '/' + this.addbean.plan.seriesName +
						'/' + this.addbean.plan.modelName
				}

				this.balancestr = !uni.$u.test.isEmpty(this.addbean.plan.balancePaymentLst) ? '已添加尾款' : ''

				this.addbean.plan.paymentMethodName = 1 == this.addbean.plan.paymentMethod ? '月付' :
					2 == this.addbean.plan.paymentMethod ? '两月付' :
					3 == this.addbean.plan.paymentMethod ? '季度' :
					4 == this.addbean.plan.paymentMethod ? '年付' :
					5 == this.addbean.plan.paymentMethod ? '一次性结清' :
					7 == this.addbean.plan.paymentMethod ? '日付' :
					8 == this.addbean.plan.paymentMethod ? '周付' :

					''

				if (!uni.$u.test.isEmpty(this.addbean.plan.paymentDay)) {
					this.payDayStr = `每月${this.addbean.plan.paymentDay}号`
				}

				if (!uni.$u.test.isEmpty(this.addbean.plan.insuranceItems)) {
					this.insuranceValueList = this.addbean.plan.insuranceItems.split(',')
				}

				if (!uni.$u.test.isEmpty(this.addbean.orderCar.accessoryItemsName)) {
					this.accessoryValueList = this.addbean.orderCar.accessoryItemsName.split(',')
				}

				let that = this;

				that.$forceUpdate()

				setTimeout(() => {

					if (!uni.$u.test.isEmpty(that.addbean.orderCar.orderFileLst) && !uni.$u.test.isEmpty(that.$refs
							.upload1)) {

						that.$refs.upload1.fileList1 = that.addbean.orderCar.orderFileLst.filter(item => {
              return 1== item.type_file||1==item.typeFile
            }).map(item => {
								return {
                  ...item,
									message: "",
									size: 52363,
									status: "success",
									thumb: that.baseImgUrl() + item.url,
									type: isVideo(item.url),
									url: item.url
								}
						})
					}
				}, 1000)

				setTimeout(() => {

					if (!uni.$u.test.isEmpty(that.addbean.orderCar.deliveryFileLst) && !uni.$u.test.isEmpty(that
							.$refs.upload2)) {

						that.$refs.upload2.fileList1 = that.addbean.orderCar.deliveryFileLst.filter(item => {
              return 1== item.type_file||1==item.typeFile
            }).map(item => {
								return {
                  ...item,
									message: "",
									size: 52363,
									status: "success",
									thumb: that.baseImgUrl() + item.url,
									type: isVideo(item.url),
									url: item.url
								}
						})
					}
				}, 1000)

				this.contractStr = this.getcontractStr()

				//处理动态数据
				this.setViewState();


			},



		},
		onLoad(op) {
			console.log('有工作流新增------------------');

			this.intentData = getApp().globalData.addOrderIntentData;
			this.querychoice = this.$store.state.params.getCarCommon;
			this.checkboxList = this.querychoice.accessoryItem;
			this.insuranceList = this.querychoice.vehicleInsurance;
			this.carInfoList = [this.$store.state.params.brandseriesmodel];

			getApp().globalData.addOrderIntentData = null


			this.defaultOrderId = op.orderId;
			this.customFieldMapBean = op.customFieldMapBean;

			if (!uni.$u.test.isEmpty(this.intentData)) {

				this.addbean.plan.rentTypeName = this.intentData.value
				this.addbean.plan.rentType = this.intentData.code
			}

			if (!uni.$u.test.isEmpty(this.querychoice)) {

				this.paymethodList = [this.querychoice.payMethod]
				let plist = this.querychoice.monthlyRentPaymentDate.map(item => {
					item.mValue = `每月${item.value}号`
					return item
				})
				this.paydayList = [plist]
			}

			this.$u.api.getCommonDeptlist({
				type: '2'
			}).then(res => {
				this.deptList = res;
			})

			uni.$on('selectCustomer', res => {
				console.log('选择了客户', res);

				this.addbean.customerId = res.customerId
				this.addbean.customerType = res.customerType
				this.addbean.customerName = res.customerName
				this.addbean.customerAddr = res.address
				this.addbean.customerTel = res.contactMobile
			})

			//添加尾款了
			uni.$on('addFinal', res => {
				this.addbean.plan.balancePaymentLst = res;
				this.balancestr = !uni.$u.test.isEmpty(this.addbean.plan.balancePaymentLst) ? '已添加尾款' : ''
			})

			//渠道商选择后的回调
			uni.$on('selChannel', res => {
				//收到选择的渠道商了
				this.addbean.plan.channelId = res.channelId
				this.addbean.plan.channelName = res.channelName
			})

			//交车工作人员选择了
			uni.$on('getRes', res => {
				//收到选择的渠道商了
				this.addbean.orderCar.deliveryOperationId = res.userId
				this.addbean.orderCar.deliveryOperationName = res.username
			})

			uni.$on('addcontract-bean', res => {
				//收到合同了
				console.log('新增订单页面收到合同了===>', res);
				this.addbean.contract = res
				this.contractStr = this.getcontractStr()
			})

			//选车了
			uni.$on('selCar', res => {

				console.log('收到了车辆', res);

				if (res.vinNo != this.addbean.orderCar.vinNo) {
					//重置其他条件
					if (!uni.$u.test.isEmpty(res.accessoryItemsName)) {

						this.accessoryValueList = res.accessoryItemsName.split(',')
					}

				}


				this.addbean.orderCar.carId = res.carId
				this.addbean.orderCar.carNo = res.carNo
				this.addbean.orderCar.vinNo = res.vinNo
				this.addbean.orderCar.deptId = res.deptId
				this.addbean.orderCar.deptName = res.deptName
				this.addbean.orderCar.depotId = res.depotId
				this.addbean.orderCar.depotName = res.depotName
				this.addbean.orderCar.cityId = res.cityId
				this.addbean.orderCar.cityName = res.cityName
			})

			if (!uni.$u.test.isEmpty(this.defaultOrderId)) {

				if (!uni.$u.test.isEmpty(this.customFieldMapBean)) {
					uni.setNavigationBarTitle({
						title: '审核编辑'
					})
				} else {
					uni.setNavigationBarTitle({
						title: '编辑订单信息'
					})
				}

				//获取老数据


				uni.showLoading({
					title: '加载中'
				})
				this.$u.api.orderActivityEditdata({
					orderId: this.defaultOrderId
				}).then(res => {
					this.handleOldData(res)
					uni.hideLoading()
				}).catch(e => {
					uni.hideLoading()
				})

			} else {
				uni.setNavigationBarTitle({
					title: '新增车辆订单'
				})

				let processStr = 1 == this.intentData.code || 3 == this.intentData.code || 4 == this.intentData.code ?
					'longRentOrderApprove' :
					2 == this.intentData.code ? 'rentSaleOrderApprove' :
					5 == this.intentData.code ? 'meltsRentOrderApprove' :
					6 == this.intentData.code ? 'purchaseOrderApprove' : ''

				uni.showLoading({
					title: '加载中'
				})
				this.$u.api.orderActivitySavedata({
					processKey: processStr
				}).then(res => {
					this.handleOldData(res)
					uni.hideLoading()
				}).catch(e => {
					uni.hideLoading()
				})

			}

		}
	}
</script>

<style lang="scss" scoped>
	.p-content {
		display: flex;
		flex-direction: column;
	}

	.u-form {
		margin: 10px;
		padding: 22rpx;
		background-color: white;
	}

	.u-input {
		font-size: 24rpx;
	}

	.mradio {
		display: flex;
		align-items: center;

		text {
			font-size: 30rpx;
			color: #666;
			margin-left: 10rpx;
		}
	}

	.deptPicker {
		position: fixed;
		z-index: 9999;
	}
</style>
